<?php
/* @var $this MailController */

$this->breadcrumbs=array(
	'Mail',
);
?>
<h1><?php echo $this->id . '/' . $this->action->id; ?></h1>

<p>
	You may change the content of this page by modifying
	the file <tt><?php echo __FILE__; ?></tt>.
</p>
<?php
$mail = new YiiMailer();
$mail->setView('contact');
$mail->setData(array('message' => 'Message to send', 'name' => 'John Doe', 'description' => 'Contact form'));
?>

<?php
$mail->render();
$mail->From = 'from@example.com';
$mail->FromName = 'John Doe';
$mail->Subject = 'Mail subject';
$mail->AddAddress(Yii::app()->params['adminEmail']);
?>

<?php
if ($mail->Send()) {
	$mail->ClearAddresses();
	Yii::app()->user->setFlash('contact','Thank you for contacting us. We will respond to you as soon as possible.');
} else {
	Yii::app()->user->setFlash('error','Error while sending email: '.$mail->ErrorInfo);
}
?>